#include <iostream>
#include <stdio.h>
#include <cstring>
using namespace std;
typedef long long ll;
const int CH=26;
int main() {
	string a,b;
	ll a_cnt[CH],b_cnt[CH];
	cin.sync_with_stdio(false);
	while (cin>>a>>b) {
		for (int i=0; i<CH; ++i) a_cnt[i]=0, b_cnt[i]=0;
		int len=a.length();
		for (int i=1; i<len; ++i) ++a_cnt[a[i]-'a'];
		len=b.length();
		for (int i=0; i<len-1; ++i) ++b_cnt[b[i]-'a'];
		ll res=(ll)a.length()*(ll)b.length();
		for (int i=0; i<26; ++i) {
			res-=a_cnt[i]*b_cnt[i];
		}
		cout<<res<<endl;
	}
	return 0;
}
